package com.baoteng.room.entity;

import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.PrimaryKey;

/**
 * Author: loren
 * Date: 2019/8/12
 */
@Entity
public class TestRoomModel {

    //注意！！！主键需要setter、getter方法
    @PrimaryKey(autoGenerate = true)
    long id;

    String name;
    int age;
    String gender;

    public TestRoomModel() {
    }

    //注意！！！
    //必须指定一个构造方法，room框架需要。并且只能指定一个
    //如果有其他构造方法，则其他的构造方法必须添加@Ignore注解
    @Ignore
    public TestRoomModel(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "TestRoomModel{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                '}';
    }
}
